import java.util.Scanner;

public class Work2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String str = scanner.nextLine();
        //I like beijing.
        //beijing. like I
        char[] arr = str.toCharArray();
        char[] ret = new char[arr.length + 1];
        int cur = arr.length - 1;
        int dest = arr.length - 1;
        int i = 0;

        while (cur >= 0) {
            while (cur >= 0 && arr[cur] != ' ') {
                cur--;
            }
            for (int j = cur + 1; j <= dest; j++) {
                ret[i++] = arr[j];
            }
            ret[i++] = ' ';
            cur--;
            dest = cur;
        }
        for (int j = cur + 1; j <= dest; j++) {
            ret[i++] = arr[j];
        }
        for (int j = 0; j < arr.length; j++) {
            System.out.print(ret[j]);
        }
    }
}
